<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let salaries = {
        John: 100,
        Pete: 300,
        Mary: 250,
      };
      function topSalary(obj) {
        const arr = Object.entries(obj);
        arr.sort((a, b) => b[1] - a[1]);
        return arr[0][0];
      }
      console.log(topSalary(salaries)); // Pete
    </script>
  </body>
</html>
